package com.new2i.action;

import java.util.HashMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.new2i.aop.LoginInterceptor;
import com.new2i.service.able.SmsService;
import com.new2i.util.Collection2JsonUtil; 
  

/**
 * 短信发送视图控制器－接口
 * 
 * @author 2i
 * @since 2015/09/06
 *
 */
@Controller
@RequestMapping("api/sms")
public class SmsApiAction extends BaseAction{
 
	@Autowired
	private transient SmsService mSmsService;
	
	/**
	 * 发送短信
	 * @param request
	 * @param response
	 * @param mobile
	 * @param content
	 */
	@LoginInterceptor
	@RequestMapping("/send")
	public void sendSms(HttpServletRequest request, HttpServletResponse response, String mobile, String content) {
		HashMap<String, Object> smsInfo = mSmsService.sendSms(mobile, content);
		String value = Collection2JsonUtil.byObject(smsInfo);
		write2client(response, value);
	}
	
}
